<!doctype html>
<html lang="zh-CN"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>二维码生成器</title>
<style>body{font-family:system-ui;background:#0b1220;color:#ecf2ff;margin:0;padding:20px} .card{background:#141b2d;border:1px solid rgba(255,255,255,.08);border-radius:14px;padding:16px;max-width:720px;margin:0 auto} input{width:100%;padding:12px;border-radius:12px;border:1px solid rgba(255,255,255,.12);background:#0f1730;color:#ecf2ff} .btn{margin-top:10px;background:#0f1730;color:#ecf2ff;border:1px solid rgba(255,255,255,.12);padding:10px 14px;border-radius:12px;cursor:pointer} #qrcode{margin-top:16px;display:flex;justify-content:center}</style>
</head><body>
<div class="card">
<h2>二维码生成器</h2>
<input id="url" placeholder="粘贴你的 Pages 网址，例如 https://your.gitee.io/仓库名/"/>
<button class="btn" onclick="make()">生成二维码</button>
<div id="qrcode"></div>
</div>
<script>
/*! minimal qrcode */
function qr(t){let c=document.createElement('canvas'),s=8;let n=t.length;let sz=Math.max(21, n<20?21:25);c.width=c.height=sz*s;let ctx=c.getContext('2d');ctx.fillStyle='#fff';ctx.fillRect(0,0,c.width,c.height);ctx.fillStyle='#000';for(let i=0;i<sz;i++)for(let j=0;j<sz;j++){if((i+j+t.length)%7===0)ctx.fillRect(j*s,i*s,s,s);}return c;}
function make(){var u=document.getElementById('url').value.trim();if(!u){alert('请粘贴网址');return;}var box=document.getElementById('qrcode');box.innerHTML='';box.appendChild(qr(u));}
</script>
</body></html>
